package com.bianmaba.remote.supports;

import com.bianmaba.commons.bean.result.OperationResult;
import com.bianmaba.dc.bean.CollectorResponse;
import lombok.extern.log4j.Log4j2;
import org.springframework.http.HttpEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
@Log4j2
public class CollectorRemoteRequestService extends BaseRemoteRequestService implements IBaseRemoteRequestService {
    public OperationResult post(String url, HttpEntity entity) {
        try {
            ResponseEntity<CollectorResponse> response = postForEntity(url, entity, CollectorResponse.class);
            CollectorResponse body = response.getBody();
            return body;
        } catch (Exception e) {
            return handleException(url, entity.getBody().toString(), e);
        }
    }
}
